﻿@{
    Layout = "~/Views/Shared/_FormWhite.cshtml";
}

<div class="wrapper animated fadeInRight">
    <form id="form" class="form-horizontal m">
    <input type="hidden" id="id" name="id" />
        <div class="form-group">
            <label class="col-sm-3 control-label ">用户名<font class="red"> *</font></label>
            <div class="col-sm-8">
                <input id="userName" name="UserName" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">密码</label>
            <div class="col-sm-8">
                <input id="password" name="Password" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">性别(0未知 1男 2女)</label>
            <div class="col-sm-8">
                <input id="gender" name="Gender" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">出生日期</label>
            <div class="col-sm-8">
                <input id="birthday" name="Birthday" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">头像</label>
            <div class="col-sm-8">
                <input id="portrait" name="Portrait" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">Email</label>
            <div class="col-sm-8">
                <input id="email" name="Email" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">手机</label>
            <div class="col-sm-8">
                <input id="mobile" name="Mobile" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">QQ</label>
            <div class="col-sm-8">
                <input id="qq" name="qq" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">微信</label>
            <div class="col-sm-8">
                <input id="wechat" name="wechat" type="text" class="form-control" />
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    $(function () {

        $('#form').validate({
            rules: {
                userName: { required: true }
            }
        });

        getForm();

    });

    /**表单初始化**/
    function getForm() {
        //修改赋值使用
        var editData = storage.get("editData");
        if (editData != null && editData.length > 0) {
            var data = JSON.parse(editData);
            //表单赋值
            $("#form").setWebControls(data);
        }
        else {
            //表单初始化
            var defaultData = {};
            $('#form').setWebControls(defaultData);
        }
    }

    /**提交数据**/
    function submitForm() {
        if ($('#form').validate().form()) {
            $.operate.save("/TeUserManager/TeUser/SaveFormJson",$("#form").getWebControls());
        }
    }
</script>

